home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / theprn09.zip / TYPE.INC < prev   
Text File  |  1992-07-15  |  9KB  |  235 lines

  1.  
  2. DEFINT A-Z
  3.  
  4. '=============================================================================
  5. '
  6. '  NAME   Type.Inc   Copyright 1992, Rob W. Smetana  All Rights Reserved.
  7. '  ====              Included with The Printer.
  8. '
  9. '  PURPOSE
  10. '  =======
  11. '
  12. '  Provide the "field structure" of both Printer.Dat (large database)
  13. '  and Printer.Cfg (small configuration file saved by Printer.Exe).
  14. '
  15. '   * BASIC programmers can use this in their programs as-is.  Just:
  16. '     - Merge or INCLUDE it in your program.
  17. '     - Open "Printer.Cfg" for Binary as #2
  18. '     - Get #1,,Header: Get #1,,Printer        '...do twice to skip labels
  19. '       Get #1,,Header: Get #1,,Printer:Close #1
  20. '     - Then print your text:
  21. '       LPrint Printer.BoldON;Text$;Printer.BoldOff
  22. '
  23. '   * If you program in another language, you should have little trouble
  24. '     translating the "structures" and simple code included here.
  25. '
  26. '
  27. '
  28. '
  29. '  RECORD LAYOUT
  30. '  =============
  31. '
  32. '  Each record (for each printer) is 1024 bytes in length.
  33. '
  34. '  Some printers have 2 or more records if they emulate 2 or more printers.
  35. '  In other words, each emulation is treated as a separate printer.  The
  36. '  field "EmulateMode" indicates which printer is being emulated -- if any.
  37. '
  38. '  ALL fields are STRINGS and all are 14 bytes long EXCEPT the first two:
  39. '
  40. '    - Reserved             is  1 byte          (used in development)
  41. '    - Printer Manufacturer is 15 bytes
  42. '
  43. '
  44. '  PLACEHOLDERS:  ASCII character 251 (√)
  45. '  ============
  46. '
  47. '  Some printer codes require "variables."  For example, to specify, say
  48. '  3/48 inch line spacing (instead of the normal 6 lines per inch), you
  49. '  send a code like Chr$(27);"L03" (for a Toshiba printer).  In this case
  50. '  both "0" and "3" are variables.
  51. '   - The database would store this code as:  L√√
  52. '   - Escape is stored as ASCII character 27.
  53. '   - ASCII 251 (√) is simply a "placeholder" which YOU must replace
  54. '     with appropriate characters.
  55. '
  56. '  You MUST replace the placeholder -- the printer code is meaningless
  57. '  otherwise.
  58. '
  59. '
  60. '  TWO TYPES
  61. '  =========
  62. '
  63. '  Below are 2 TYPES BASIC programmers can use to read printer records.
  64. '  If you program in other langauges, you should have little trouble
  65. '  translating these into structures appropriate for other langages.
  66. '
  67. '   * These TYPES can be used to read either the large database itself
  68. '     (Printer.Dat) or the small config. file (Printer.Cfg) saved by
  69. '     Printer.Exe when you select a printer.
  70. '
  71. '   * The first TYPE (Header) reads the 1st 44 bytes of records.
  72. '     Here you'll find the printer's Manufacturer, Model and Emulation mode.
  73. '
  74. '   * The 2nd TYPE (Printer) will read/hold actual printer codes.
  75. '
  76. '
  77. '  NOTE:  By separating these, if you don't care about the header, you're
  78. '         not forced to keep it around.  Read it (with any 44-byte variable),
  79. '         throw it away, then read just the printer codes.
  80. '=============================================================================
  81.  
  82.  
  83. TYPE Hdr                               'all records start w/ a 44-byte header
  84.  
  85. '=========== Start with a header (Printer manufacturer, model and emulation).
  86.  
  87.            Reserved AS STRING * 1      'Used during development
  88.  
  89.        Manufacturer AS STRING * 15     'eg., Epson, Panasonic, Star, etc.
  90.  
  91.  
  92. '=========== All remaining fields are 14 bytes each.
  93.  
  94.               Model AS STRING * 14     'Specific printer model (eg., LQ-510)
  95.  
  96.         EmulateMode AS STRING * 14     'If not blank, this describes the
  97.                                        'printer being emulated.
  98.  
  99.                                        '44 bytes through here !!!
  100. END TYPE
  101.  
  102. DIM Header AS Hdr
  103.  
  104. '=============================================================================
  105.  
  106. TYPE Printer
  107.  
  108. '=========== 70, 14-byte printer codes follow.
  109. '
  110. '            The last few are blank "expansion" fields for our use
  111. '            (if we add codes), or for use by you or your user.
  112. '
  113. '            NOTE:  We may expand into these -- starting with the
  114. '            first.  If you're concerned that later we might collide
  115. '            with you, start your codes at the end, then move forward.
  116.  
  117.  
  118.          Initialize AS STRING * 14     'Reset to power-on mode (many printers
  119.                                        'have no reset -- a shame).
  120.  
  121. '...pitch/character sets/master attributes
  122.  
  123.             Pitch10 AS STRING * 14     'Turn on 10 characters-per-inch (CPI; Pica)
  124.             Pitch12 AS STRING * 14     'Turn on 12 CPI (eg., Elite)
  125.         CondensedON AS STRING * 14     'Turn on Condensed mode (15-17 CPI)
  126.        CondensedOFF AS STRING * 14     'Turn Condensed mode off
  127. ProportionalSpacing AS STRING * 14     'Turn on Proportional Spacing
  128.        FixedSpacing AS STRING * 14     'Turn on Fixed Spacing
  129.  
  130.       SelectCharSet AS STRING * 14     'Select Character Set (USA, French, etc.)
  131.    SelectMasterFont AS STRING * 14     'Select Master Font (Roman, Prestige, etc.)
  132.    SelectPrintStyle AS STRING * 14     'Select Elite, Condensed, etc.
  133.           DraftMode AS STRING * 14     'Turn Draft Mode on (high speed)
  134.   NearLetterQuality AS STRING * 14     'Turn on Near-Letter Quality mode
  135.  
  136. '... Line spacing
  137.  
  138.       LinesPerInch6 AS STRING * 14     'Turn on 6 lines-per-inch (LPI)
  139.       LinesPerInch8 AS STRING * 14     '  "  "  8    "   "   "
  140.      LinesPerInch12 AS STRING * 14     '  "  "  12   "   "   "
  141.  
  142.   VariableLineSpace AS STRING * 14     'Change line spacing (LPI) -- fine increments
  143.     AltVariableLine AS STRING * 14     'Alternate way to change line spacing
  144.  
  145. '... Attributes/Emphasis/SuperScript/Etc
  146.  
  147.      DoubleStrikeON AS STRING * 14     'Turn on Double-Strike mode
  148.     DoubleStrikeOFF AS STRING * 14     '  "  off  "       "     "
  149.  
  150.        DoubleWideON AS STRING * 14     'Turn Double-Wide on
  151.       DoubleWideOFF AS STRING * 14     '  "    "     "   off
  152.  
  153.      DoubleHeightON AS STRING * 14     'Turn Double-High on
  154.     DoubleHeightOFF AS STRING * 14     '  "    "     "   off
  155.  
  156.        EmphasizedON AS STRING * 14     'Turn Emphasized mode on
  157.       EmphasizedOFF AS STRING * 14     '  "       "      "   off
  158.  
  159.              BoldOn AS STRING * 14     'Turn Bold mode on
  160.             BoldOff AS STRING * 14     '  "   "     "   off
  161.  
  162.         UnderlineON AS STRING * 14     'Turn Underline mode on
  163.        UnderlineOff AS STRING * 14     '  "       "     "   off
  164.  
  165.            ItalicON AS STRING * 14     'Turn Italic mode on
  166.           ItalicOff AS STRING * 14     '  "     "     "   off
  167.  
  168.       SuperScriptON AS STRING * 14     'Superscript on
  169.      SuperScriptOFF AS STRING * 14     '    "       off
  170.  
  171.         SubScriptON AS STRING * 14     'Subscript on
  172.        SubScriptOFF AS STRING * 14     '    "     off
  173.  
  174. '... Other
  175.  
  176.   SkipPerforationON AS STRING * 14     'Skip perforation zone
  177.  SkipPerforationOFF AS STRING * 14     'Turn off Skip perf.
  178.  
  179. UnidirectionalPrint AS STRING * 14     'Unidirectional print on (for accuracy)
  180.  BidirectionalPrint AS STRING * 14     'Bidirectional print on (for speed)
  181.  
  182.          PushCursor AS STRING * 14     '(LaserJet) Push (save) cursor position
  183.           PopCursor AS STRING * 14     '     "     Pop (restore)  "       "
  184.  
  185.    PageLengthInches AS STRING * 14     'Set page length in INCHES
  186.     PageLengthLines AS STRING * 14     'Set page length in LINES
  187.  
  188.         SetTabStops AS STRING * 14     'Set Tab Stops
  189.  
  190.        SetTopMargin AS STRING * 14     'Set Top Margin
  191.     SetBottomMargin AS STRING * 14     ' "  Bottom "
  192.       SetLeftMargin AS STRING * 14     ' "  Left   "
  193.      SetRightMargin AS STRING * 14     ' "  Right  "
  194.  
  195.  
  196. '... The next 4 codes let you move to vertical or horizontal locations,
  197. '    either in absolute terms (ie., a specific row/column) or relative to
  198. '    where you are (ie., move 5 dots down).
  199.  
  200. AbsVerticalLocation AS STRING * 14     'Move vertically to a specific Row (or dot)
  201. RelVerticalLocation AS STRING * 14     'Move "y" rows/dots from where we are now
  202.  
  203.    AbsHorizLocation AS STRING * 14     'Move horizontally to a column (or dot)
  204.    RelHorizLocation AS STRING * 14     'Move "x" columns/dots from where we are
  205.  
  206.      InterCharSpace AS STRING * 14     'Expand/shrink the spacing between
  207.                                        'letters (some newer printers only)
  208.  
  209.  
  210. '... Expansion fields to give us, you or your users options to add codes.
  211.  
  212.          User1 AS STRING * 14
  213.          User2 AS STRING * 14
  214.          User3 AS STRING * 14
  215.          User4 AS STRING * 14
  216.          User5 AS STRING * 14
  217.          User6 AS STRING * 14
  218.          User7 AS STRING * 14
  219.          User8 AS STRING * 14
  220.          User9 AS STRING * 14
  221.         User10 AS STRING * 14
  222.         User11 AS STRING * 14
  223.         User12 AS STRING * 14
  224.         User13 AS STRING * 14
  225.         User14 AS STRING * 14
  226.         User15 AS STRING * 14
  227.         User16 AS STRING * 14
  228.         User17 AS STRING * 14         'This rounds out the total record
  229.                                       'length to 1024 bytes (44 + 980)
  230.  
  231. END TYPE
  232.  
  233. DIM Printer AS Printer
  234.  
  235.